package com.cc.openeye.dynamic.recommend.items.banner

import androidx.compose.runtime.Composable
import com.cc.openeye.backgroundColor
import com.cc.openeye.borderRadius
import com.cc.openeye.dynamic.recommend.entity.dynamicResponse.ItemX
import com.tencent.kuikly.compose.coil3.rememberAsyncImagePainter
import com.tencent.kuikly.compose.foundation.Image
import com.tencent.kuikly.compose.foundation.layout.Box
import com.tencent.kuikly.compose.foundation.layout.PaddingValues
import com.tencent.kuikly.compose.foundation.layout.fillMaxHeight
import com.tencent.kuikly.compose.foundation.layout.fillMaxSize
import com.tencent.kuikly.compose.foundation.layout.fillMaxWidth
import com.tencent.kuikly.compose.foundation.layout.height
import com.tencent.kuikly.compose.foundation.pager.HorizontalPager
import com.tencent.kuikly.compose.foundation.pager.rememberPagerState
import com.tencent.kuikly.compose.ui.Alignment
import com.tencent.kuikly.compose.ui.Modifier
import com.tencent.kuikly.compose.ui.graphics.Color
import com.tencent.kuikly.compose.ui.unit.dp


@Composable
fun BannerItem(itemList: List<ItemX>) {
    HorizontalPager(
        state = rememberPagerState { itemList.size },
        modifier =
            Modifier
                .height(180.dp).borderRadius(5.dp),
        contentPadding = PaddingValues(horizontal = 20.dp),
        pageSpacing = 3.dp
    ) { page ->
        Box(
            modifier =
                Modifier
                    .fillMaxSize()
                    .backgroundColor(Color(0xfff5f5f5))
                    .borderRadius(5.dp),
            contentAlignment = Alignment.Center,
        ) {
            Image(
                modifier = Modifier.fillMaxWidth().fillMaxHeight(),
                painter = rememberAsyncImagePainter(itemList[page].data?.image),
                contentDescription = "",
            )


        }
    }
}